import { createRouter, createWebHashHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import LoginView from '@/views/LoginView.vue'
import LayOut from '@/views/LayOut.vue'
import AboutView from '@/views/AboutView.vue'
import UserAdminView from '@/views/UserAdminView.vue'

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    //重定向
    {
      path: '/',
      redirect: '/home',
    },
    {
      path: '/login',
      name: 'login',
      component: LoginView,
    },
    {
      path: '/',
      name: 'layout',
      component: LayOut,
      children: [
        {
          path: '/home',
          name: 'home',
          component: HomeView,
        },
        {
          path: '/about',
          name: 'about',
          component: AboutView,
        },
        {
          path: '/userAdmin',
          name: 'userAdmin',
          component: UserAdminView,
        },
        {
          path: '/userAddAdmin',
          name: 'userAddAdmin',
          component: () => import('@/views/UserAdminAddView.vue'),
        },
        {
          path: '/noticeMan',
          name: 'noticeMan',
          component: () => import('@/views/notice/NoticeManagerView.vue'),
        },
        {
          path: '/noticeCateMan',
          name: 'noticeCateMan',
          component: () => import('@/views/notice/NoticeCategoryManagerView.vue'),
        },
      ],
    },
  ],
})

export default router
